package cn.demomaster.quickpicturer.constants;

public enum ImageActionType {
    // Take a photo
    TAKE_PHOTO(0),
    TAKE_PHOTO_CROP(1),
    TAKE_PHOTO_FOR_ID_CARD(3),
    // Scan a QR code
    SCAN_QR_CODE(15),

    // Crop an image
    CROP_IMAGE(16),

    // Take a photo of an ID card
    TAKE_ID_PHOTO(7),
    SELECT_FROM_GALLERY(8),
    SELECT_FROM_CUSTOM_GALLERY(9),
    SELECT_FROM_GALLERY_AND_CROP(10),

    SELECT_FROM_CUSTOM_GALLERY_AND_CROP(11);

    private final int value;

    ImageActionType(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    /**
     * 根据值查找枚举实例。
     *
     * @param value 枚举值
     * @return 枚举实例，如果没有找到则返回null
     */
    public static ImageActionType fromValue(int value) {
        for (ImageActionType actionType : values()) {
            if (actionType.getValue() == value) {
                return actionType;
            }
        }
        return null;
    }
}
